{extend name='public/layout' /}
{block name='search'}{/block}
{block name='content'}

<div class="login_bg">
    <div class="loin_mid">
        <div class="tab05">
            <ul class="idTabs">
                <li><a href="{:url('user.login/index')}">登录</a></li>
                <li><a href="{:url('user.login/reg')}" class="selected">注册</a></li>
            </ul>
        </div>
        <form action="{:url('regDo')}" method="post" name="myForm" id="myForm" data-uri="{:url('ajaxCheckUser')}">
            <div class="loin_body mar05">
                <div class="login_n1"><span class="login_ico05"></span>
                <input id="username" name="username" type="text" class="input04" placeholder="用户名">
            </div>
                <div class="loin_body">
                    <div class="login_n1"><span class="login_ico02"></span>
                        <input id="password" name="password" type="password" class="input04" placeholder="请设置密码">
                    </div>
                </div>
                    <div class="loin_body">
                        <div class="login_n1"><span class="login_ico02"></span>
                         <input id="repassword" name="repassword" type="password" class="input04" placeholder="请填写确认密码">
                        </div>
                    </div>
            <div class="loin_body">
                 <div class="login_n1"><span class="login_ico01"></span>
                 <input name="mobile" id="mobile" type="text" class="input04" placeholder="请填写手机号码">
                </div>
            </div>
            <div class="loin_body">
                 <div class="login_n1"><span class="login_ico04"></span>
                    <input name="email" id="email" type="text" class="input04" placeholder="请填写电子邮箱">
                </div>
                <div class="overflow_h">
                    <div class="login_n3"><span class="login_ico03"></span>
                        <input name="captcha_code" id="captcha_code" type="text" class="input05" placeholder="请输入图形验证码">
                    </div>
                    <div class="login_n4"><img src="{:captcha_src()}" class="verify_img" width="119" height="50"></div>
                </div>
                <p>
                    <input type="radio" name="model" value="1" id="genren" checked><label for="genren">个人会员</label>
                    <input type="radio" name="model" value="2" id="agency"><label for="agency">经纪人</label>
                </p>
            </div>

                <p><input name="checkbox" type="checkbox" value="1" checked id="checkbox" disabled>我已阅读并同意<a target="_blank" href="{:url('Pages/detail',['cate'=>$oneCate['cate'][7]['alias']])}" class="org">《{$site.title}用户协议》</a></p>
                <p><a href="javascript:;" onclick="$('#myForm').submit();" class="but22">立即注册</a></p>
            </div>

        </form>


    </div>
</div>
<script src="__PUBLIC__/js/plugins/layervalide.js"></script>
<script src="__PUBLIC__/js/plugins/jquery.ajax.form.js"></script>
<script src="__PUBLIC__/js/layer/layer.js"></script>
<script>
    $(function(){
        $.formValidator.initConfig({formid:"myForm",autotip:true});
        $("#username").formValidator({onshow:'',onfocus:'用户名由3-15个字符组成'}).regexValidator({regexp:"ps_username",datatype:"enum",onerror:"用户名由3-15个中文字符英文字符或数字组成"}).ajaxValidator({
            type : "get",
            url : $('#myForm').data('uri'),
            datatype : "json",
            async:'false',
            success : function(result){
                if(result.status == 0){
                    return false;
                }else{
                    return true;
                }
            },
            onerror : '该昵称已被占用',
            onwait : '查询中,请稍候...'
        });
        $("#password").formValidator({onshow:'',onfocus:'请填写密码'}).inputValidator({min:6,onerror:'密码至少由6个字符组成'});
        $("#repassword").formValidator({onshow:"",onfocus:"请再次填写密码"}).compareValidator({desid:"password",operateor:"=",onerror:"输入两次密码不同。"});
        $("#captcha_code").formValidator({onshow:'',onfocus:'请填写验证码'}).inputValidator({min:3,max:3,onerror:'验证码由3个字符组成'});
        $("#mobile").formValidator({onshow:'',onfocus:'请填写手机号码'}).regexValidator({regexp:"mobile",datatype:"enum",onerror:"请填写正确的手机号码将用于密码找回"}).ajaxValidator({
            type : "get",
            url : $('#myForm').data('uri'),
            datatype : "json",
            async:'false',
            success : function(result){
                if(result.status == 0){
                    return false;
                }else{
                    return true;
                }
            },
            onerror : '该手机号码已被占用',
            onwait : '查询中,请稍候...'
        });
        $("#email").formValidator({onshow:'',onfocus:'请填写邮箱号码'}).regexValidator({regexp:"email",datatype:"enum",onerror:"请填写正确的邮箱号码将用于密码找回"}).ajaxValidator({
            type : "get",
            url : $('#myForm').data('uri'),
            datatype : "json",
            async:'false',
            success : function(result){
                if(result.status == 0){
                    return false;
                }else{
                    return true;
                }
            },
            onerror : '该邮箱号码已被占用',
            onwait : '查询中,请稍候...'
        });
        $('#myForm').ajaxForm({success:complate,dataType:'json'});
        function complate(result){
            if(result.status == 1){
                layer.msg(result.msg,{icon:1});
                setTimeout(function(){window.location.href = result.uri;},2000);
            } else {
                layer.msg(result.msg,{icon:2});
            }
        }
    });
    $(".verify_img").click(function(){
        var timenow = new Date().getTime();
        $(this).attr("src","{:captcha_src()}?t"+timenow);
    });
</script>
{/block}